#ifndef JTOOLUNITBOX_H
#define JTOOLUNITBOX_H

#include <QTEGui/qteguiglobal.h>
#include <QFrame>

namespace QTE
{

class JToolUnitBoxPrivate;

class QTEGUI_EXPORT JToolUnitBox : public QFrame
{
	Q_OBJECT

public:
	explicit JToolUnitBox(QWidget *parent = nullptr);
	explicit JToolUnitBox(const QString &title, QWidget *parent = nullptr);
	~JToolUnitBox();

public Q_SLOTS:
	void setBoxTitle(const QString &text);
	void setWidget(QWidget *widget, bool deleteOld = true);

public Q_SLOTS:
	void setCheckable(bool enable);
	void setChecked(bool check);

public Q_SLOTS:
	void setExpand(bool expand);
	inline void collapse() { setExpand(false); }
	inline void expand() { setExpand(true); }

public:
	QString boxTitle() const;
	const QWidget *widget() const;
	QWidget *widget();
	bool isCheckable() const;
	bool isChecked() const;
	bool isExpand() const;

protected:
	bool eventFilter(QObject *watched, QEvent *event) override;

private:
	JToolUnitBoxPrivate *d_ptr;
};

} //namespace QTE


#endif //JTOOLUNITBOX_H
